package com.example;

import de.greenrobot.daogenerator.DaoGenerator;
import de.greenrobot.daogenerator.Entity;
import de.greenrobot.daogenerator.Schema;

public class ProjectGreenDaoGenerator {

    public static void main(String args[]){
        Schema schema = new Schema(1, "com.lanou3g.zjl.chating.dao.greendao");
        addBallDatabase(schema);
        try {
            // 创建实体类.第二个参数填Android Module的路径
            new DaoGenerator().generateAll(schema, "./app/src/main/java");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    private static void addBallDatabase(Schema schema) {

        Entity userEntity = schema.addEntity("User");
        userEntity.addStringProperty("userName").primaryKey();
        userEntity.addStringProperty("psw");
        userEntity.addStringProperty("nickName");
        userEntity.addStringProperty("avatar");

        Entity conversationEntity = schema.addEntity("Conversation");
        conversationEntity.addStringProperty("userName").primaryKey();
        conversationEntity.addStringProperty("nickName");
        conversationEntity.addStringProperty("avater");
        conversationEntity.addStringProperty("time");

    }

}
